﻿#include "systemjournalwid.h"
#include <QTimer>

SystemJournalWid::SystemJournalWid(QWidget* parent)
	: QWidget(parent)
{
	ui.setupUi(this);
	setFixedWidth(300);
	timer = new QTimer(this);
	timer->setInterval(1000);

	connect(timer, &QTimer::timeout, [&]() {
		QStringList str1 = m_read.ReadTraceJournal();
		for (auto& i : str1) {
			ui.textBrowser->append(i);
			ui.textBrowser->moveCursor(ui.textBrowser->textCursor().End);
		}
		QStringList str2 = m_read.ReadeErrorJournal();
		for (auto& i : str2) {
			ui.textBrowser_2->append(i);
		}
		QStringList str3 = m_read.ReadeWarnJournal();
		for (auto& i : str3) {
			ui.textBrowser_3->append(i);
		}
		ui.textBrowser->moveCursor(ui.textBrowser->textCursor().End);
		});
	timer->start();
}

SystemJournalWid::~SystemJournalWid()
{}

void SystemJournalWid::on_pushButton_clicked()
{
	ui.textBrowser->clear();
}
void SystemJournalWid::on_pushButton_2_clicked()
{
	ui.textBrowser_3->clear();
}
void SystemJournalWid::on_pushButton_3_clicked()
{
	ui.textBrowser_2->clear();
}
